<?php

/**
 * This is the model class for table "expedientes".
 *
 * The followings are the available columns in table 'expedientes':
 * @property integer $id
 * @property integer $EXP_N
 * @property integer $EXP_A
 * @property integer $fojas
 * @property string $caratula
 * @property integer $ocupanteDoc
 * @property integer $barrFis
 * @property integer $barrPos
 * @property integer $codPos
 * @property string $FechaInicio
 * @property string $SUPTER
 * @property string $DPTO
 * @property string $CIRCUN
 * @property string $SECCION
 * @property string $CHACRA
 * @property string $QUINTA
 * @property string $FRACCION
 * @property string $MANZ
 * @property string $PARCELA
 * @property integer $CALLE1
 * @property integer $CALLE2
 * @property integer $ALTCF1
 * @property integer $ALTCF2
 * @property string $FECHAREAL
 * @property string $EXP_E
 * @property string $EXP_L
 */
class expedientes extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'expedientes';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('EXP_N, EXP_A, fojas, ocupanteDoc, barrFis, barrPos, codPos, CALLE1, CALLE2, ALTCF1, ALTCF2', 'numerical', 'integerOnly'=>true),
			array('caratula', 'length', 'max'=>150),
			array('SUPTER, DPTO, CIRCUN, CHACRA, QUINTA, MANZ, PARCELA', 'length', 'max'=>5),
			array('SECCION', 'length', 'max'=>2),
			array('FRACCION', 'length', 'max'=>6),
			array('EXP_E, EXP_L', 'length', 'max'=>50),
			array('FechaInicio, FECHAREAL', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, EXP_N, EXP_A, fojas, caratula, ocupanteDoc, barrFis, barrPos, codPos, FechaInicio, SUPTER, DPTO, CIRCUN, SECCION, CHACRA, QUINTA, FRACCION, MANZ, PARCELA, CALLE1, CALLE2, ALTCF1, ALTCF2, FECHAREAL, EXP_E, EXP_L', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'emovimientos' => array(self::HAS_MANY, 'Emovimiento', 'expedientes_id'),
			'ocupanteDoc0' => array(self::BELONGS_TO, 'Personas', 'ocupanteDoc'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'Id',
			'EXP_N' => 'Exp N',
			'EXP_A' => 'Exp A',
			'fojas' => 'Fojas',
			'caratula' => 'Caratula',
			'ocupanteDoc' => 'Ocupante Doc',
			'barrFis' => 'Barr Fis',
			'barrPos' => 'Barr Pos',
			'codPos' => 'Cod Pos',
			'FechaInicio' => 'Fecha Inicio',
			'SUPTER' => 'Supter',
			'DPTO' => 'Dpto',
			'CIRCUN' => 'Circun',
			'SECCION' => 'Seccion',
			'CHACRA' => 'Chacra',
			'QUINTA' => 'Quinta',
			'FRACCION' => 'Fraccion',
			'MANZ' => 'Manz',
			'PARCELA' => 'Parcela',
			'CALLE1' => 'Calle1',
			'CALLE2' => 'Calle2',
			'ALTCF1' => 'Altcf1',
			'ALTCF2' => 'Altcf2',
			'FECHAREAL' => 'Fechareal',
			'EXP_E' => 'Exp E',
			'EXP_L' => 'Exp L',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);

		$criteria->compare('EXP_N',$this->EXP_N);

		$criteria->compare('EXP_A',$this->EXP_A);

		$criteria->compare('fojas',$this->fojas);

		$criteria->compare('caratula',$this->caratula,true);

		$criteria->compare('ocupanteDoc',$this->ocupanteDoc);

		$criteria->compare('barrFis',$this->barrFis);

		$criteria->compare('barrPos',$this->barrPos);

		$criteria->compare('codPos',$this->codPos);

		$criteria->compare('FechaInicio',$this->FechaInicio,true);

		$criteria->compare('SUPTER',$this->SUPTER,true);

		$criteria->compare('DPTO',$this->DPTO,true);

		$criteria->compare('CIRCUN',$this->CIRCUN,true);

		$criteria->compare('SECCION',$this->SECCION,true);

		$criteria->compare('CHACRA',$this->CHACRA,true);

		$criteria->compare('QUINTA',$this->QUINTA,true);

		$criteria->compare('FRACCION',$this->FRACCION,true);

		$criteria->compare('MANZ',$this->MANZ,true);

		$criteria->compare('PARCELA',$this->PARCELA,true);

		$criteria->compare('CALLE1',$this->CALLE1);

		$criteria->compare('CALLE2',$this->CALLE2);

		$criteria->compare('ALTCF1',$this->ALTCF1);

		$criteria->compare('ALTCF2',$this->ALTCF2);

		$criteria->compare('FECHAREAL',$this->FECHAREAL,true);

		$criteria->compare('EXP_E',$this->EXP_E,true);

		$criteria->compare('EXP_L',$this->EXP_L,true);

		return new CActiveDataProvider('expedientes', array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * @return expedientes the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}